import React, { memo } from 'react'
import { connect } from 'react-redux'

const List = memo((props) => {
  console.log(props);
  return (
    <div>
      <div>{ props.banners}</div>
      <button onClick={() => { props.add()}}>add</button>
    </div>
  )
})

/* ---------------------------redux容器盒子-------------------------- */
const mapStateToProps = (state) => {
  console.log('state',state);
  return {
    banners: state.ListReducer,
  }
}

const mapDispatchToProps = (dispatch) => {
  return {
    add: () => dispatch({type:'add',value:1}),
  }
}
export default connect(mapStateToProps, mapDispatchToProps)(List)